import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import dayjs from 'dayjs';

@Entity({ name: 'product_category' })

class ProductCategoryEntity {
  @PrimaryGeneratedColumn({ zerofill: true })
  categoryId: number;

  @Column({ length: 50 })
  name: string;

  @Column('json', { nullable: true })
  baseConfig: Record<string, any>;

  @Column('int', { width: 8, zerofill: true })
  adminId: number;

  @Column('json', { nullable: true })
  optionalConfig: Record<string, any>;

  @Column({ length: 25, default: dayjs().format('YYYY-MM-DD HH:mm:ss') })
  createdTime: string;

  @Column('bigint', { width: 50, default: new Date().getTime() })
  createdTimestamp: number;
}

export default ProductCategoryEntity;